#include <QFile>
#include <QTextStream>

#include "debugout.h"

DebugOut::DebugOut(const QString &s, const QString &log): filename(log)
{
	static bool first = true;
	QFile file(filename);
	if (first && !file.open(QIODevice::WriteOnly))
		return;
	if (!first && !file.open(QIODevice::WriteOnly | QIODevice::Append))
		return;
	
	QTextStream os(&file);
	os << s;
	
	first = false;
}

DebugOut::~DebugOut()
{
	
}

/*
void DebugOut::out(const QString &s)
{
	QFile file(filename);
	if (!file.open(QIODevice::WriteOnly))
		return;
	
	QTextStream os(&file);
	os << s;
}
*/
